<%@ page import="bcared.*" %>
<%@ page import="java.text.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>

<%
	String today = null;
	Today t = new Today();
	today = t.getToday();
	request.setAttribute("picture", "Customer");
	request.setAttribute("title", "Service Order Details");
	request.setAttribute("header", "Today is "
			+ today);
%>
			
<%@ include file="header.jsp"%>

<%
int soid = Integer.parseInt(request.getParameter("SOID"));
ServiceOrder curServiceOrder = new ServiceOrder(soid); 
int custid = curServiceOrder.getCustomerID();
ResultSet rsProblem = null;	
rsProblem = curServiceOrder.getSOType();


//String SO = request.getParameter("SOID").toString();
//readonly so id and useful table, make resolution txt

%>
<TD width="850" vAlign="top">  
<form name=form2 action=customerhome.jsp method=post >
<h2>Service Order Details</h2>


<table width=850 border=0 cellpadding="5">

<tr>
<td width=25%>Service Order ID</td>
<td width=25%><%=curServiceOrder.getSOID() %></td>
<td width=25%>Customer Name:</td>
<td width=25%><%=curServiceOrder.getCustomerName() %></td>
</tr>


<tr>
<td width=25%>Service Order Description:</td>
<td width=25%><%=curServiceOrder.getServiceTypeDescription()%></td>
<td width=25%>Contact Name:</td>
<td width=25%><%=curServiceOrder.getContactName() %></td>
</tr>


<tr>
<td width=25%>Open Date:</td>
<td width=25%><%=curServiceOrder.getOpenDate() %></td>
<td width=25%>Contact Telephone Number:</td>
<td width=25%><input maxlength=30 name=CloseDate size=40 type=text value='<%=curServiceOrder.getContactPhone() %>'/></td>
</tr>


<tr>
<td width=25%>Close Date:</td>
<td width=25%><input maxlength=30 name=CloseDate size=40 type=text value='<%=curServiceOrder.getCloseDate() %>'/></td>
<td width=25%>Priority Description:</td>  
<td width=25%><input maxlength=30 name=PriorityID size=40 type=text readonly=readonly value='<%=curServiceOrder.getPriorityDescription() %>'/></td>
</tr>


<tr>
<td colspan=2>&nbsp;</td>
<td>Patient on Table?</td>  
<td width=25%>
<% if (curServiceOrder.getLifeInDanger() == 0 ) { %>
No
<% } else { %>  Yes <% } %></td>
</tr>

<tr>
<td colspan="4"><hr/></td>
</tr>

<tr>
<td colspan="4"><h3>Description</h3></td>
</tr>


<tr>
<td width=25%>Problem Description:</td>
<td width=25%><%=curServiceOrder.getProblemDesc() %></td>
<td width=25%>Estimate Time of Completion:</td>
<td width=25%><input maxlength=30 name=estTime size=40 type=text value='<%=curServiceOrder.getTimeEstimate() %>'/></td>
</tr>


<tr> 
<td width=25%>Current Status:</td>
<td width=25%><input maxlength=30 name=CurrStat size=40 type=text readonly=readonly value='<%=curServiceOrder.getSOStatusDesc() %>'/></td>
<td width=25%>Product Name:</td>
<td width=25%><input maxlength=30 name=ProductName size=40 type=text readonly=readonly value='<%=curServiceOrder.getProductName() %>'/></td>
</tr>


<tr>
<td width=25%>Resolution Notes:</td>
<td colspan="3"><input maxlength=30 name=Resolution size=130 type=text readonly=readonly value='<%=curServiceOrder.getResolutionNotes() %>'/></td>
</tr>


<tr>
<td colspan="4"><hr/></td>
</tr>


<tr>
<td colspan="4"><h3>Customer Details</h3></td>
</tr>


<tr>
<td width=25%>Customer ID:</td>
<td width=25%><input maxlength=30 name=CustID size=40 type=text readonly=readonly value='<%=curServiceOrder.getCustomerID() %>'/></td>
<td width=25%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Address:</td>
<td width=25%><input maxlength=30 name=custName size=40 type=text readonly=readonly value='<%=curServiceOrder.getAddress1() %>'/></td>
</tr>


<tr>
<td width=25%>Email:</td>
<td width=25%><input maxlength=30 name=email size=40 type=text readonly=readonly value='<%=curServiceOrder.getContactEmail() %>'/></td>
<td width=25%></td>
<td width=25%><input maxlength=30 name=Address2 size=40 type=text readonly=readonly value='<%=curServiceOrder.getAddress2() %>'/></td>
</tr>


<tr>
<td width=25%></td>
<td width=25%></td>
<td width=25%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;City:</td>
<td width=25%><input maxlength=30 name=City size=40 type=text readonly=readonly value='<%=curServiceOrder.getCity() %>'/></td>
</tr>


<tr>
<td width=25%></td>
<td width=25%></td>
<td width=25%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State:</td>
<td width=25%><input maxlength=30 name=State size=40 type=text readonly=readonly value='<%=curServiceOrder.getState() %>'/></td>
</tr>


<tr>
<td width=25%></td>
<td width=25%></td>
<td width=25%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Zip:</td>
<td width=25%><input maxlength=30 name=Zip size=40 type=text readonly=readonly value='<%=curServiceOrder.getZip() %>'/></td>
</tr>


<tr>
<td colspan="4"><h3>Notes</h3></td>
</tr>
<%
ArrayList<CheckInOut> checks = new ArrayList<CheckInOut>();
checks = curServiceOrder.getChecks();

for (int i = 0; i < checks.size(); i++) {

Engineer e = checks.get(i).getEngineer();
 %>
<tr>
<td width=25%>Engineer:</td>
<td width=25%><%=e.getFirstName() + " " + e.getLastName() %></td>
<td colspan=2><%=checks.get(i).getActionNotes() %></td>

</tr>
<%
}
 %>

<tr>

      <td colspan="4" align=center><input type="button" name="return" value="Return" onClick="history.back()"</td>
 </tr>
</table>
</form>
		</TD>
	</TR>
</TABLE>

</body>
<script Language=JavaScript>

function chkPriority() {
	if (form2.soDesc.value == 3 || form2.soDesc.value == 4 || form2.soDesc.value == 7 || form2.soDesc.value == 8)
	{  
		form2.PriorityID.value="High"; 
		return ;   
	} 
	if (form2.soDesc.value == 1 || form2.soDesc.value == 6)
	{  
		form2.PriorityID.value="Medium"; 
		return ;   
	}
	if (form2.soDesc.value == 2 || form2.soDesc.value == 5 || form2.soDesc.value == 9)
	{  
		form2.PriorityID.value="Low"; 
		return ;   
	}
}

function getUrgent() {
	if (form2.Urgency.checked == true){
			form2.PriorityID.value="Patient on Table"; 
			}else{
			form2.PriorityID.value=" ";
			 }
		return ;   
}
</script>

</html>		
<%@ include file="footer.jsp"%>
